import md5 from 'js-md5'

export function buildWrapperCompNameByRoute(route) {
  const meta = route.meta
  const { useRoutePathAsWrapperCompName = true } = meta
  return buildWrapperCompName(
    useRoutePathAsWrapperCompName,
    route.name,
    route.fullPath
  )
}
export function buildWrapperCompName(
  useRoutePathAsWrapperCompName,
  routeName,
  routePath
) {
  return useRoutePathAsWrapperCompName
    ? `${routeName}_${md5.hashStr(routePath)}`
    : `${routeName}_Wrapper`
}
export function removeListStrVal(list, needRemoveStr) {
  const idx = list.findIndex(item => item === needRemoveStr)
  if (idx >= 0) {
    list.splice(idx, 1)
  }
}
